package com.gxa.meiye.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxa.meiye.admin.mapper.OrderMapper;
import com.gxa.meiye.admin.service.OrderService;
import com.gxa.meiye.core.pojo.domain.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Author: zy
 * @CreateTime: 2022-07-23  15:36
 */
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
   @Autowired
   private OrderMapper orderMapper;
    @Override
    public Integer select(String phone) {
        return null;
    }

//    @Override
//    public Integer add(Order order) {
//        return null;
//    }
//支付成功修改状态
    @Override
    public Integer update(String orderNumber,String serialNumber) {
        LocalDateTime payTime=LocalDateTime.now();
        Integer update = orderMapper.update(payTime,serialNumber,orderNumber);

        return update;
    }

    @Override
    public String selectLiuSui(String orderNumber) {
        String s = orderMapper.selectLiuSui(orderNumber);

        return s;
    }

    @Override
    public Integer updateRefund(String orderNumber) {
        Integer integer = orderMapper.updateRefund(orderNumber);
        return integer;
    }

    @Override
    public List<Order> list(String phone) {
        List<Order> list = orderMapper.list(phone);

        return list;
    }

    @Override
    public Integer updateRe(String orderNumber) {
        Integer integer = orderMapper.updateRe(orderNumber);
        return integer;
    }

    @Override
    public Integer updateCancel(String orderNumber) {
        Integer integer = orderMapper.updateCancel(orderNumber);
        return integer;
    }

    @Override
    public Integer addCancel(String orderNumber, String reason, String content) {
        Integer integer = orderMapper.selectOrderId(orderNumber);
        Integer integer1 = orderMapper.selectReasonId(reason);
        Integer integer2 = orderMapper.addCancel(integer, integer1, content);
        return integer2;
    }

    @Override
    public Integer Cancel(String orderNumber) {
        Integer cancel = orderMapper.Cancel(orderNumber);
        return cancel;
    }

    @Override
    public String selectMeiPhone(String orderNumber) {
        String s = orderMapper.selectMeiPhone(orderNumber);
        return s;
    }
}
